<HTML><HEAD><TITLE>unlock(+Module, +Password)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Modules</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>unlock(+Module, +Password)</H1>
Unlocks the access to the module Module, if the password given in Password
is correct


<DL>
<DT><EM>Module</EM></DT>
<DD>Atom.
</DD>
<DT><EM>Password</EM></DT>
<DD>String.
</DD>
</DL>
<H2>Description</H2>
   unlock(Module, Password) unlock a module previously locked with
   lock_pass(Password).  The access to the module is now again possible.

<P>
   An error is raised (and the module not unlocked) when trying to unlock a
   module with a wrong password or when trying to unlock a module locked
   with lock/0.

<P>

<H3>Modes and Determinism</H3><UL>
<LI>unlock(+, +) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Module or Password is/are not instantiated.
<DT><EM>(5) type error </EM>
<DD>Module is instantiated, but not to an atom or Password is    instantiated but not to a string.
<DT><EM>(80) not a module </EM>
<DD>Module is not a module.
<DT><EM>(82) trying to access a locked module </EM>
<DD>Trying to access a locked module Module
<DT><EM>(98) key not correct </EM>
<DD>Key not correct
</DL>
<H2>Examples</H2>
<PRE>
    % After compiling the following code:
     :- module(m).
     :- export pub/0.
     pub :- writeln(pub).
     priv :- writeln(priv).
     :- lock_pass("secret").


    ?- module(m).
    trying to access a locked module in module(m)

    ?- call(pub) @ m.
    pub
    yes.

    ?- call(priv) @ m.
    trying to access a locked module in priv

    ?- assert(foo) @ m.
    trying to access a locked module in assert_(foo, m)

    ?- unlock(m, "pass").
    key not correct in unlock(m, "pass")

    ?- unlock(m, "secret").
    yes.

    ?- call(priv) @ m.
    priv
    yes.

    ?- assert(foo) @ m.
    yes.
</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/modules/lock-0.html">lock / 0</A>, <A HREF="../../kernel/modules/lock_pass-1.html">lock_pass / 1</A>, <A HREF="../../kernel/modules/get_module_info-3.html">get_module_info / 3</A>
</BODY></HTML>
